#define  _CRT_SECURE_NO_WARNINGS 1

#include <stdlib.h>

typedef struct Node
{
	int val;
	struct Node* next;
}SLNode;

void SLTPopBack(SLNode** pphead)
{
	assert(*pphead != NULL);
	if ((*pphead)->next == NULL)
	{
		free(*pphead);
		*pphead = NULL;
	}
	else
	{
		SLNode* prev = *pphead;
		while (prev->next->next != NULL)
		{
			prev = prev->next;
		}
		free(prev->next);
		prev->next = NULL;
	}
}

void SLTPopFront(SLNode** pphead)
{
	assert(*pphead != NULL);
	SLNode* tmp = *pphead;
	*pphead = (*pphead)->next;
	free(tmp);
	tmp = NULL;
}